home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-17 | 8.7 KB | 215 lines | [TEXT/MPS ] |
- #
- # ****************************************************************************
- #
- # File Name: MacDrawPro.vu
- #
- # Contains: Quick look test script for MacDraw Pro version 1.5
- #
- # Written by: Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
- #
- # Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
- #
- # ****************************************************************************
- # C h a n g e H i s t o r y (most recent first):
- # ****************************************************************************
- #
- # Vers Date Author Description
- # ---- -------- ------ ---------------------------------------------
- # <1.0.6> 9/30/93 KTA Initialize gFileName prior to gApptitle being updated by
- # launchTwitch().
- # <1.0.5> 9/28/93 KTA Added returnVal for ModifyDocument hook.
- # <1.0.2> 6/16/93 NAGA Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
- # <1+> 5/25/93 NAGA Adding header and porting old files to follow new standards
- #
- # ****************************************************************************
- #
-
-
-
- ########################################################################
- # External libraries
- #=======================================================================
- Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib","DA.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
-
-
- #########################################################################
- ######## Application Specific Tasks
- #########################################################################
-
- #########################################################################
- # InitAppGlobals()
- #========================================================================
- # Author: ML
- # Description: Sets up tools and fonts for MacDraw Pro. This task
- # must be called first.
- # Parameters: None
- # Returns: Nothing
- # Examples: InitAppGlobals()
- #========================================================================
- # History:
- #
- ########################################################################
- task InitAppGlobals()
- begin
-
- logstr("setting up {global gApptitle}'s globals");
- global kClick, kDrag, kMultiDrag, kMultiClickDrag, kMultiClick;
- global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
- global kToolPaletteNum := 1;
- global kColorPaletteNum := 2;
- global kPatternPaletteNum := 3;
- global kGradientPaletteNum := 4;
-
- global gWindowInset := {27,41,20,20}; # Window inset
- global gScreenInset := {0,20,0,0}; # Screen inset
- global gVoidRect := {}; # Rect not to draw in - coordinates should be RelativeToWindow
- global gLineWeights := {'1 point','2 point','4 point','6 point','8 point','10 point'};
- global gTextStr;
-
- global gPaletteList := {
- { #### Start Palette #1 - Tools
- {0, 21, 25, 228,0}, # Location of palette relative to the window
- # top is in first tool because it is larger
- kPalDocWind, # Palette type
- {1,12}, # Size of Tool matrix {numElemsWide,numElemsTall}
- {0,17} # Offset between tools {h,v}
- }, #### End Palette #1
- { #### Start Palette #2 - Colors
- {152, 29, 148, 44,0}, # PopPoint, TopLeft of first color (if 4 item list - coords are absolute)
- # (if 5 item list - coords are relativeToWindow )
- kPopUpPal, # Palette type
- {21,8}, # Size of Tool matrix {numElemsWide,numElemsTall}
- {10,10} # Offset between tools {h,v}
- }, #### End Palette #2
- { #### Start Palette #3 - Pattern
- {175, 28, 176, 46,0}, # PopPoint, TopLeft of first pattern (if 4 item list - coords are absolute)
- # (if 5 item list - coords are relativeToWindow )
- kPopUpPal, # Palette type
- {8,8}, # Size of Tool matrix {numElemsWide,numElemsTall}
- {16,16} # Offset between tools {h,v}
- }, #### End Palette #3
- { #### Start Palette #4 - Gradient
- {200, 28, 198, 47,0}, # PopPoint, TopLeft of first gradient (if 4 item list - coords are absolute)
- # (if 5 item list - coords are relativeToWindow )
- kPopUpPal, # Palette type
- {8,2}, # Size of Tool matrix {numElemsWide,numElemsTall}
- {16,16} # Offset between tools {h,v}
- } # End Palette #4
- };
-
- ### MacDraw Pro {Flag, Pattern, Line, Color}
- ### Palette Elements:= Tool#, Pal#, ToolName, ToolType, DblClktoEnd SetAttributes
- global SelectTool := { 1, 1, "Select", kClick, 0, {0} };
- global CharTool := { 2, 1, "Char", kDrag, 0, {gTextStr,0,0,1}};
- global LineTool := { 3, 1, "Line", kDrag, 0, {1,0,1,0} };
- global RectTool := { 4, 1, "Rectangle",kDrag, 0, {1,1,1,1} };
- global RndRectTool := { 5, 1, "RndRect", kDrag, 0, {1,1,1,1} };
- global OvalTool := { 6, 1, "Oval", kDrag, 0, {1,1,1,1} };
- global ArcTool := { 7, 1, "Arc", kDrag, 0, {2,1,1,1} };
- global FreeTool := { 8, 1, "Freehand", kMultiDrag, 0, {2,1,1,1} };
- global PolyTool := { 9, 1, "Polygon", kMultiClick,1, {2,1,1,1} };
- global BezTool := { 10, 1, "BezTool", kMultiClick,1, {2,1,1,1} };
- global NoteTool := { 11, 1, "Note", kDrag, 0, {gTextStr} };
- global ColorPickerTool := { 12, 1, "ColorPicker", kClick, 0, {0} };
- global PenLine := { '', {87,29,1}, "PenLine", 0, 0, {0} };
- global ZoomOut := { '', {30,-8,2}, "ZoomOut", 0, 0, {0} };
-
- # global Tool list
- global gToolList:={ SelectTool,
- CharTool,
- LineTool,
- RectTool,
- RndRectTool,
- OvalTool,
- ArcTool,
- FreeTool,
- PolyTool,
- BezTool,
- NoteTool,
- ColorPickerTool
- };
-
- ### font characteristic lists
- global gFontSizeList := {'9','10','12','14','18', '24','36','48'};
- global gFontStyleList := {'Bold','Italic','Outline', 'Underline','Shadow', 'Superscript','Subscript','–Small Caps'};
-
- ### Name of the Plain (style) menu item ####
- global gPlainStyle := "Plain Text"; # Plain-Style menu item
-
- ### How to get to the next line
- global gNextLineMethod := 1;
- ### 1 - ReturnKey, 2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
-
- ### Does moving to the next line clear all font info
- global gNextLineClearsFontSettings := 0;
-
- end; #InitMacDrawProTools
-
- #########################################################################
- # MacDrawModifyDocument()
- #========================================================================
- # Author: ML
- # Description: Modify MacDraw Document
- # Parameters: None
- # Returns: Nothing
- # Examples: MacDrawModifyDocument();
- # Assumptions: None
- # Applications: MacDraw Pro
- #========================================================================
- # History:
- #
- #########################################################################
- task MacDrawModifyDocument()
- begin
- return(Scrapbook(global kScrapPict));
- end;
-
- #########################################################################
- # MacDrawSetupDoText()
- #========================================================================
- # Author: ML
- # Description: Sets up DoText
- # Parameters: None
- # Returns: Nothing
- # Examples: MacDrawSetupDoText();
- # Assumptions: None
- # Applications: MacDraw Pro
- #========================================================================
- # History:
- #
- #########################################################################
- task MacDrawSetupDoText()
- begin
- logstr("Setting up for DoText...");
- SetTool(global SelectTool); # Deselects any selected objects
- end;
-
- ################################################################################
- #################### Main script ####################
- ################################################################################
- script MacDrawPro (ScriptLevel:= -1)
- begin
- InitGlobals(ScriptLevel); # initialize your general globals
- InitDraw();
- InitFonts();
- global gApptitle := "MacDraw Pro";
- global gAppVersion := '1.5'; # version of app you will be running
- global gFileName := "@!@-{gBuildVers}-{gAppTitle}"; # This is used in SaveAs when saving files
- SuiteStart('MacDrawPro.vu'); # begin a new test suite
- if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
- begin
- global gModifyDocument:= task MacDrawModifyDocument; # define app specific task
- global gSetLine := Task SetLineMenuItems; # Requires VU 2.0
- global gSetupDoText:= task MacDrawSetupDoText; # define app specific task
- InitAppGlobals(); # init app specific globals
- (*
- *)
- DoSetUpApp(,,,,1,1,1);
- DoDraw();
- DoText();
- DoWindow();
- DoCloseApp(1);
- end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
- SuiteEnd();
- end; # script MacDrawPro
- # Need to add views